package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.PrintedVersion;
import com.indusfo.spc.pojo.ProcessBlxx;
import com.indusfo.spc.service.PrintedVersionService;
import com.indusfo.spc.service.ProcessBlxxService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author: 熊冰
 * @Date: 2019/11/9 13:11
 * 打印版本
 */
@Controller
@RequestMapping("/printedVersion")
public class PrintedVersionController {
	@Autowired
	private PrintedVersionService printedVersionService;

	//查询
	@RequestMapping(value="/queryPrintedVersion")
	@ResponseBody
	public JSONObject queryPrintedVersion(PrintedVersion printedVersion) {
		JSONObject json = printedVersionService.queryPrintedVersion(printedVersion);
		return json;
	}

	//新增
	@RequestMapping(value="/insertPrintedVersion", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject insertPrintedVersion(PrintedVersion printedVersion) {
		JSONObject json = printedVersionService.insertPrintedVersion(printedVersion);
		return json;
	}

	//修改
	@RequestMapping(value = "/updatePrintedVersion",method= RequestMethod.POST)
	@ResponseBody
	public JSONObject updatePrintedVersion (PrintedVersion printedVersion){
		JSONObject json=printedVersionService.updatePrintedVersion(printedVersion);
		return json;
	}

	//删除
	@RequestMapping(value="/deletePrintedVersion", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject deletePrintedVersion(@RequestParam("printedVersionIds") List<Integer> printedVersionIds, Integer dataState) {
		dataState = 2;
		JSONObject json = printedVersionService.deletePrintedVersion(printedVersionIds, dataState);
		return json;
	}

	//启用
	@RequestMapping(value="/startPrintedVersion", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject startPrintedVersion(@RequestParam("printedVersionIds") List<Integer> printedVersionIds, Integer dataState) {
		dataState = 2;
		JSONObject json = printedVersionService.deletePrintedVersion(printedVersionIds, dataState);
		return json;
	}

	//停用
	@RequestMapping(value="/stopPrintedVersion", method= RequestMethod.POST)
	@ResponseBody
	public JSONObject stopPrintedVersion(@RequestParam("printedVersionIds") List<Integer> printedVersionIds, Integer dataState) {
		dataState = 2;
		JSONObject json = printedVersionService.deletePrintedVersion(printedVersionIds, dataState);
		return json;
	}





}
